using Godot;

public partial class CDeadState : CState
{
    [Export] public bool mInit = false;
    [Export] public bool mDeadAniEnd = false;
    public override void run(Node n, double delta)
    {
        if (n is NCharacter cha)
        {
            _init(cha);
            if (!mDeadAniEnd)
                return;

            CHelp.free(cha, false);
        }
    }

    void _init(NCharacter cha)
    {
        if (mInit)
            return;
        mInit = true;

        cha.Shape2D.Disabled = true;
        cha.Ani.Stop();
        cha.AniPlayer.Play("dead");
    }
}